package cn.fanyc.action.spring.cloud.action06.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 请求客户端
 *
 * @author Fanyc
 * @date 2019/12/10 20:44
 */
@RestController
@RequestMapping("/")
@RefreshScope
public class CallController {

    /**
     * 名称
     */
    @Value("${userservice.props.name:}")
    private String name;

    /**
     * 来源
     */
    @Value("${userservice.props.from:}")
    private String from;

    /**
     * 获取属性
     */
    @GetMapping({"", "/", "/index"})
    public String index() {
        return String.format("My name is %s,I am from %s", name, from);
    }
}
